<!doctype html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-model="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .fade-enter-active,.fade-leave-active {
            transition: opacity 0.5s;
        }
        .fade-enter,.fade-leave-to {
            opacity:0.8;
        }
    </style>
</head>
<body>

<div id="app">

    <my-component></my-component>
</div>


</body>
<script src="../../vue@2.4.2.js"></script>
<script>
    Vue.component('myComponent',{
        template:`<div>
            <button @click="show=!show">Toggle</button>
            <transition name="fade">
                <p v-if="show">Hello.</p>
            </transition>
        </div>`,
        data: function () {
            return {
                show:true
            }
        }
    });
    var app=new Vue({
        el:'#app'
    });



</script>
</html>